<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3" xmlns:head="http://www.w3.org/1999/html">
<head th:include="public/public_css::public_css ('质检单（附件管理）')"/>

<body style="background-color: #f2f2f2;">
<div class="layui-fluid larry-wrapper">
    <div class="layui-card">
        <div class="layui-row layui-col-space30">
            <div class="layui-col-xs24">
               <!-- <form class="layui-form layui-card-header  layui-card-header-auto" id="searchForm">
                    <div class="layui-inline">
                        <label class="layui-form-label">ASN单号</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="asnbh"/>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">PO编号</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="cgbh"/>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">供应商</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="gysmc"/>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">货品编号</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="hpbh"/>
                        </div>
                    </div>

                    <div class="layui-inline inline-search-btn">
                        <a class="layui-btn layui-btn-normal" data-type="reload">搜索</a>
                    </div>

                    <div class="moreSearch" style="display: none">

                        <div class="layui-inline">
                            <label class="layui-form-label">货品名称</label>
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input" name="hpmc"/>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">上架库位</label>
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input" name="sjmc"/>
                            </div>
                        </div>

                        <div class="layui-inline">
                            <label class="layui-form-label">生成开始时间</label>
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input" name="stime" id="stime"
                                       placeholder="yyyy-MM-dd"/>
                            </div>
                        </div>

                        <div class="layui-inline">
                            <label class="layui-form-label"> </label>
                            <div class="layui-input-inline" style="height:20px">
                                &#45;&#45;
                            </div>
                        </div>

                        <div class="layui-inline">
                            <label class="layui-form-label">生成结束时间</label>
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input" name="etime" id="etime" placeholder="yyyy-MM-dd"/>
                            </div>
                        </div>
                    </div>
                </form>-->

<!--
                <div class="moreBtn"><i class="layui-icon layui-icon-triangle-d" style="color: #1E9FFF;"></i></div>
<!--
&ndash;&gt;             <div style="float: left;margin-top: 171px;"><button type="button" class="layui-btn" id="test1">上传图片</button></div>
-->

                <div class="group-button" id="toolbar">
                    <a class="layui-btn layui-btn-sm layui-btn-normal id="test1"">
                        <i class="layui-icon">&#x1005;</i> 选择文件
                    </a>
                    <!--<button type="button" class="layui-btn" id="test1">
                        <i class="layui-icon">&#xe67c;</i>选择文件
                    </button>
                    <button type="button" class="layui-btn" id="testListAction">
                        <i class="layui-icon">&#xe67c;</i>上传到服务器
                    </button>-->

                    <a class="layui-btn layui-btn-sm layui-btn-normal edit-btn">
                        <i class="layui-icon">&#x1005;</i> 上传到服务器
                    </a>
                </div>


                <!--列表-->
                <section class="panel panel-padding layui-card-body">
                    <div class="pro">
                        <table id="table" class="table text-nowrap"></table>
                    </div>
                </section>
            </div>
        </div>
    </div>
</div>
</body>


<div th:include="public/public_js::public_js"></div>
<style type="text/css">
    .moreBtn {
        width: 50px;
        height: 20px;
        text-align: center;
        color: #fff;
        line-height: 20px;
        background-color: #eee;
        position: relative;
        margin: 0 auto;
        cursor: pointer;
    }

    .moreBtn:before {
        content: '';
        display: block;
        width: 35px;
        height: 20px;
        position: absolute;
        transform: skewX(30deg);
        background: #eee;
        border-top-left-radius: 8px;
        left: -20px;
        top: 0;
    }

    .moreBtn:after {
        content: '';
        display: block;
        width: 35px;
        height: 20px;
        position: absolute;
        transform: skewX(-30deg);
        background: #eee;
        border-top-right-radius: 8px;
        top: 0;
        right: -20px;
    }
</style>
<script>
layui.use('upload', function(){
  var upload = layui.upload;

  upload.render({
  elem: '#test1'
  ,url: 'http://192.168.5.244:8870/file/upload/excel/zxwms/shipment'
  ,auto: false //选择文件后不自动上传
  ,bindAction: '#testListAction' //指向一个按钮触发上传
  ,choose: function(obj){
    //将每次选择的文件追加到文件队列
    var files = obj.pushFile();

    //预读本地文件，如果是多文件，则会遍历。(不支持ie8/9)
    obj.preview(function(index, file, result){
      console.log(index); //得到文件索引
      console.log(file); //得到文件对象
      console.log(result); //得到文件base64编码，比如图片

      //obj.resetFile(index, file, '123.jpg'); //重命名文件名，layui 2.3.0 开始新增

      //这里还可以做一些 append 文件列表 DOM 的操作

      //obj.upload(index, file); //对上传失败的单个文件重新上传，一般在某个事件中使用
      //delete files[index]; //删除列表中对应的文件，一般在某个事件中使用
    });
  }
});
});
</script>
<script>

    $("form input[type=text]").each(function () {
        this.value = $.trim(this.value);

        $(document).ready(function () {//通用方法去输入框前后空格
            $("form").on("change", function () {
                $("form input[type=text]").each(function () {
                    this.value = $.trim(this.value);
                });
            })
        });
    });

    console.log("我来了！！ ");
    $(".moreBtn").on("click",function () {
        $(".moreSearch").toggle();
    })
    layui.use(['list', 'layer', 'zzpUtils', 'jquery', 'laydate'], function () {
        var zzpUtils = layui.zzpUtils,
            $ = layui.jquery,
            laydate = layui.laydate;
        zzpUtils.select2({
            elem: ".js-data-example-ajax",
            url: "/wmsrrailwayplatform/list"
        });
        window.operateEvent = {
            "click .layui-btn-primary": function (e, value, row, index) {
                alert(row.mc);
            },
            "click #check": function (e, value, row, index) {//删除
                checkDialog(row.ysdh);
            }
        };
        /*顶部按钮多选启用*/
        $("#btn_qi").on('click', function () {
            var index = 0;
            var $rows = $table.bootstrapTable('getSelections');
            //判断选中的库区里是否有已经启用的
            for (var i = 0; i < $rows.length; i++) {
                if ($rows[i].jhzt == 1) {
                    index++;
                }
            }
        })

        //	回车查询
        /*document.onkeydown = function (event) {
            e = event ? event : (window.event ? window.event : null);
            if (e.keyCode == 13) {
                //执行的方法
                $('#search_button').click();
            }
        };*/

        var $table = zzpUtils.table({
            elem: '#table',
            isApi: true,
            pagination: true,
            url: '/reports/baseWmsShelvesDailiesPage',
            columns: [{
                field: '',
                checkbox: true
            }, {
                field: 'mc',
                title: '附件名称'
            }, {
                field: 'asnbh',
                title: '链接地址'
            },{
                field: 'caozuo',
                title: '操作',
                events: operateEvent,
                formatter: operateFormatter
            }],
            queryParams: function () {//查询条件
                return zzpUtils.getFormJson($("#searchForm"));
            },
            /*onDblClickRow: function (row, index) {/!*双击行展示详情*!/
                btn_cha(row.id);
            }*/
        });

        function operateFormatter(value, row, index) {
            return [
                '<a class="layui-btn layui-btn-primary layui-btn-xs" id="check">下载</a>'
            ].join('')
        }

        $(".inline-search-btn").on('click', function () {
            zzpUtils.refreshTable("#table");
        })
    });
</script>
</html>